<!DOCTYPE html>
<html>
<head>
<title>系统概述</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=8, IE=9, IE=10, chrome=1" />
<meta name="renderer" content="webkit" />
<link href="${ctx }framework/css/font.css" rel="stylesheet" />
<link href="${ctx }framework/miniui/themes/material/miniui.css" rel="stylesheet" />
<link href="${ctx }framework/css/app.min.1.css" rel="stylesheet" type="text/css" />
<link href="${ctx }framework/css/app.min.2.css" rel="stylesheet" type="text/css" />
<script src="${ctx }framework/main.js"></script>
<style type="text/css">
.input-group-addon{width:160px;text-align: right;}
</style>
<script type="text/javascript">
	Page.onLoad(function(){});
	function onDrawNode(e) {
		if(e.dragAction=="add"){
			var Id = e.dragNode.Id;
			var ParentId = e.dropNode.Id;
			Server.sendRequest("EaoGrid.saveOrUpdateHelpMenu",{Id:Id,ParentId:ParentId},function(response){
				if(response.Status == 1) {
					top.mini.showTips({content:response.Message,state:'success'});
					mini.get('tree').reload();
				} else {
					mini.alert(response.Message);
				}
			});  
		}else if(e.dragAction=="before"){
			var Id = e.dragNode.Id;
			var ParentId = e.dropNode.ParentId;
			var Position = e.dropNode.Position-1;
			Server.sendRequest("EaoGrid.saveOrUpdateHelpMenu",{Id:Id,ParentId:ParentId,Position:Position},function(response){
				if(response.Status == 1) {
					top.mini.showTips({content:response.Message,state:'success'});
					mini.get('tree').reload();
				} else {
					mini.alert(response.Message);
				}
			});  
		}else{
			var Id = e.dragNode.Id;
			var ParentId = e.dropNode.ParentId;
			var Position = e.dropNode.Position+1;
			Server.sendRequest("EaoGrid.saveOrUpdateHelpMenu",{Id:Id,ParentId:ParentId,Position:Position},function(response){
				if(response.Status == 1) {
					top.mini.showTips({content:response.Message,state:'success'});
					mini.get('tree').reload();
				} else {
					mini.alert(response.Message);
				}
			});  
		}
    }
</script>
</head>
	<body class="dialog">
		<form id="form2">
			<ul id="tree" class="mini-tree"  style="width:500px;padding:5px;" 
		        showTreeIcon="true" textField="Title" idField="Id" parentField="ParentId" resultAsTree="false"  ondrop="onDrawNode"
		        allowDrag="true" allowDrop="true" allowLeafDropIn="true"  method="EaoGrid.getMenus" expandOnLoad="2" ajaxOptions="{data:{Type:'${Type}'}}"
		        >
   			</ul>
		</form>
	</body>
</html>